package com.mars.ticket.controller;

import com.mars.ticket.request.SysNoticeRequest;
import com.mars.ticket.response.result.R;
import org.springframework.web.bind.annotation.*;
import lombok.AllArgsConstructor;

import java.util.Arrays;

import com.mars.ticket.entity.SysNotice;
import com.mars.ticket.service.ISysNoticeService;

/**
 * SysNotice 控制层
 *
 * @Author wq
 * @Date 2021-05-20
 **/
@RestController
@RequestMapping("/sysNotice")
@AllArgsConstructor
public class SysNoticeController {

    private final ISysNoticeService sysNoticeService;


    @PostMapping("/list")
    public R list(@RequestBody SysNoticeRequest request) {
        return R.success(sysNoticeService.list(request));
    }

    @PostMapping("/add")
    public R add(@RequestBody SysNoticeRequest request) {
        sysNoticeService.add(request);
        return R.success();
    }

    @GetMapping("/delete")
    public R delete(Integer id) {
        sysNoticeService.delete(id);
        return R.success();
    }

    @GetMapping("/detail")
    public R detail(Integer id) {
        return R.success(sysNoticeService.detail(id));
    }

    @PostMapping("/update")
    public R update(@RequestBody SysNoticeRequest request) {
        sysNoticeService.update(request);
        return R.success();
    }

}